package edu.ncu.service.impl;

import edu.ncu.dao.NewsDao;
import edu.ncu.entity.News;
import edu.ncu.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("newsService")
public class NewsServiceImpl implements NewsService {

    final NewsDao newsDao;

    public NewsServiceImpl(NewsDao newsDao) {
        this.newsDao = newsDao;
    }

    @Override
    public List<News> findAll() {
        System.out.println("进入了newsService");
        return newsDao.findAll();
    }

    @Override
    public int saveNews(News news) {
        return newsDao.saveNews(news);
    }

    @Override
    public int deleteNews(int newsId) {
        return newsDao.deleteNews(newsId);
    }
}
